$(document).ready(function(){
    $("#xiaohai").fullpage({
        scrollingSpeed:800,
        anchors:['page1','page2','page3','page4','page5'],
        navigation:true,
        navigationPosition:'right',
        paddingTop:'80px',
        navigationTooltips:['HOME','Skill','Experience','Hobby','Contact'],

        //fixedElements:'.xiaohai-nav',
        //menu:'.xiaohai-nav
        //


        afterRender:function(){

            $('#box01_text .p1').velocity({
                opacity:'1',
            },{
                duration: 800,
                easing: "swing",
                complete: function(){
                    $('#box01_text .p2').velocity({
                        opacity:'1',
                    },{
                        duration: 800,
                        easing: "swing",
                        complete:function(){
                            $('#box01_text .p3').velocity({
                                opacity:'1',
                            },{
                                duration: 800,
                                easing: "swing",
                            })
                        }
                    })
                }

            })
        },


        afterLoad:function(link,index){
            switch(index){
                case 1:

                    $('#box01_text .p1').velocity({
                        opacity:'1',
                    },{
                        duration: 800,
                        easing: "swing",
                        complete: function(){
                            $('#box01_text .p2').velocity({
                                opacity:'1',
                            },{
                                duration: 800,
                                easing: "swing",
                                complete:function(){
                                    $('#box01_text .p3').velocity({
                                        opacity:'1',
                                    },{
                                        duration: 800,
                                        easing: "swing",
                                    })
                                }
                            })
                        }

                    })

                    break;
                case 2:
                    $(".box2-progress").velocity({
                        width:'786px',
                        opacity:'1',
                    },{
                        duration: 1000,

                    })

                    //$(".box02_text h1").addClass('text-opacity');
                    //setTimeout(function(){
                    //    $(".box02_text .overline").addClass('text-opacity');
                    //},500)
                    //
                    //var li = $(".box02_text p");
                    //console.log(li.length);

                    //$(".box02_text h1").velocity({
                    //    opacity:'1',
                    //    translateX:'0px'
                    //},{
                    //    duration: 700,
                    //
                    //})

                    var seq=[
                        {
                            elements:$('.box02_text h1'),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },
                        {
                            elements:$('.overline'),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },
                        {
                            elements:$(".box02_text p").eq(0),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(1),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        }
                        ,{
                            elements:$(".box02_text p").eq(2),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(3),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(4),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(5),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(6),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(7),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(8),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(9),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(10),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(11),
                            properties:{opacity:'1',translateX:'0px'},
                            options:{duration:500}
                        }
                    ];

                    $.Velocity.RunSequence(seq);  //执行函数
                    //var text = $(".box02_text p").eq(1);
                    //console.log(text);
                    break;
                case 3:

                   // 上面的代码太长的话就很难维护和调试 所以我们用动作针
                    var seq1=[
                        {
                            elements:$(".eq1"),
                            properties:{opacity:'1',translateX:'1px'},
                            options:{duration:500}   //方法
                        },
                        {
                            elements:$(".eq3"),  //表示对象
                            properties:{opacity:'1',translateY:'0px'}, //css样式
                            options:{duration:500}   //方法
                        },
                        {
                            elements:$(".eq2"),  //表示对象
                            properties:{opacity:'1',translateX:'0px'}, //css样式
                            options:{duration:500}   //方法
                        }
                    ];

                    $.Velocity.RunSequence(seq1);  //执行函数



                    break;
            }
        },

        onLeave:function(link,index){

            switch(link){
                case 1:
                    $('#box01_text .p1').velocity({
                        opacity:'0',
                    },{
                        duration: 800,
                        easing: "swing",
                        complete: function(){
                            $('#box01_text .p2').velocity({
                                opacity:'0',
                            },{
                                duration: 800,
                                easing: "swing",
                                complete:function(){
                                    $('#box01_text .p3').velocity({
                                        opacity:'0',
                                    },{
                                        duration: 800,
                                        easing: "swing",
                                    })
                                }
                            })
                        }

                    })
                case 2:
                    $(".box2-progress").velocity({
                        width:'0',
                        opacity:'0',
                    },{
                        duration: 1000,

                    })

                    var seq=[
                        {
                            elements:$('.box02_text h1'),
                            properties:{opacity:'1',translateX:'320px'},
                            options:{duration:500}
                        },
                        {
                            elements:$('.overline'),
                            properties:{opacity:'1',translateX:'320px'},
                            options:{duration:500}
                        },
                        {
                            elements:$(".box02_text p").eq(0),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(1),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        }
                        ,{
                            elements:$(".box02_text p").eq(2),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(3),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(4),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(5),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(6),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(7),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(8),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(9),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(10),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        },{
                            elements:$(".box02_text p").eq(11),
                            properties:{opacity:'0',translateX:'320px'},
                            options:{duration:500}
                        }
                    ];

                    $.Velocity.RunSequence(seq);  //执行函数

                    break;
                case 3:
                    var seq1=[
                        {
                            elements:$(".eq1"),
                            properties:{opacity:'0',translateX:'-100px'},
                            options:{duration:500,easing:'linear'}   //方法
                        },
                        {
                            elements:$(".eq3"),  //表示对象
                            properties:{opacity:'0',translateY:'100px'}, //css样式
                            options:{duration:500,easing:'linear'}   //方法
                        },
                        {
                            elements:$(".eq2"),  //表示对象
                            properties:{opacity:'0',translateX:'100px'}, //css样式
                            options:{duration:500,easing:'linear'}   //方法
                        }
                    ];

                    $.Velocity.RunSequence(seq1);  //执行函数
                    break;
            }
        },



    })
})

$('.cry1').on('mouseover',function(){
    $(this).velocity('callout.swing');
});
$('.cry2').on('mouseover',function(){
    $(this).velocity('callout.pulse');
});
$('.cry3').on('mouseover',function(){
    $(this).velocity('callout.bounce');
});

function nextPage(){
    $.fn.fullpage.moveSectionDown();
}
